<template>
  <a-form :form="form">
    <a-row>
      <!-- <a-col :md="12" :sm="24">
         <a-form-item
           label="学号"
           :labelCol="{span: 7,offset: 1}"
           :wrapperCol="{span: 15, offset: 1}"
         >
           <a-input v-decorator="[
             'xh',
             {
               rules: [{ required: true, message: '请输入学号!' }],
             }
           ]"/>
         </a-form-item>
       </a-col>-->
      <a-col :md="12" :sm="24">
        <a-form-item
          label="考生编号"
          :labelCol="{span: 7,offset: 1}"
          :wrapperCol="{span: 15, offset: 1}"
          selfUpdate
        >
          <a-input v-decorator="['ksbh']"/>
        </a-form-item>
      </a-col>
      <a-col :md="12" :sm="24">
        <a-form-item
          label="入学成绩类型"
          :labelCol="{span: 7,offset: 1}"
          :wrapperCol="{span: 15, offset: 1}"
          selfUpdate
        >
          <a-select allowClear v-decorator="['rxcjlx']">
            <a-select-option v-for="i in TYPE0313" :key="i.id" :value="i.code">{{ i.name }}</a-select-option>
          </a-select>
        </a-form-item>
      </a-col>
      <a-col :md="12" :sm="24">
        <a-form-item
          label="外国语名称"
          :labelCol="{span: 7,offset: 1}"
          :wrapperCol="{span: 15, offset: 1}"
          selfUpdate
        >
          <a-select allowClear v-decorator="['wgym']">
            <a-select-option v-for="i in TYPE0114" :key="i.id" :value="i.code">{{ i.name }}</a-select-option>
          </a-select>
        </a-form-item>
      </a-col>
      <a-col :md="12" :sm="24">
        <a-form-item
          label="外国语成绩"
          :labelCol="{span: 7,offset: 1}"
          :wrapperCol="{span: 15, offset: 1}"
          selfUpdate
        >
          <a-input-number style="width: 100%" :max="9999" v-decorator="['wgycj']"/>
        </a-form-item>
      </a-col>
      <a-col :md="12" :sm="24">
        <a-form-item
          label="政治理论名称"
          :labelCol="{span: 7,offset: 1}"
          :wrapperCol="{span: 15, offset: 1}"
          selfUpdate
        >
          <a-input v-decorator="['zzllmc']"/>
        </a-form-item>
      </a-col>
      <a-col :md="12" :sm="24">
        <a-form-item
          label="政治理论成绩"
          :labelCol="{span: 7,offset: 1}"
          :wrapperCol="{span: 15, offset: 1}"
          selfUpdate
        >
          <a-input-number style="width: 100%" :max="9999" v-decorator="['zzllcj']"/>
        </a-form-item>
      </a-col>
      <a-col :md="12" :sm="24">
        <a-form-item
          label="业务课一名称"
          :labelCol="{span: 7,offset: 1}"
          :wrapperCol="{span: 15, offset: 1}"
          selfUpdate
        >
          <a-select allowClear v-decorator="['ywkym']" showSearch :filterOption="filterOption">
            <a-select-option v-for="i in TYPE0010" :key="i.id" :value="i.code">{{ i.name }}</a-select-option>
          </a-select>
          <!-- <a-input v-decorator="['ywkymc']"/> -->
        </a-form-item>
      </a-col>
      <a-col :md="12" :sm="24">
        <a-form-item
          label="业务课一成绩"
          :labelCol="{span: 7,offset: 1}"
          :wrapperCol="{span: 15, offset: 1}"
          selfUpdate
        >
          <a-input-number style="width: 100%" :max="9999" v-decorator="['ywkycj']"/>
        </a-form-item>
      </a-col>
      <a-col :md="12" :sm="24">
        <a-form-item
          label="业务课二名称"
          :labelCol="{span: 7,offset: 1}"
          :wrapperCol="{span: 15, offset: 1}"
          selfUpdate
        >
          <a-select allowClear v-decorator="['ywkem']" showSearch :filterOption="filterOption">
            <a-select-option v-for="i in TYPE0010" :key="i.id" :value="i.code">{{ i.name }}</a-select-option>
          </a-select>
          <!-- <a-input v-decorator="['ywkemc']"/> -->
        </a-form-item>
      </a-col>
      <a-col :md="12" :sm="24">
        <a-form-item
          label="业务课二成绩"
          :labelCol="{span: 7,offset: 1}"
          :wrapperCol="{span: 15, offset: 1}"
          selfUpdate
        >
          <a-input-number style="width: 100%" :max="9999" v-decorator="['ywkecj']"/>
        </a-form-item>
      </a-col>
      <a-col :md="12" :sm="24">
        <a-form-item
          label="业务课三名称"
          :labelCol="{span: 7,offset: 1}"
          :wrapperCol="{span: 15, offset: 1}"
          selfUpdate
        >
          <a-select allowClear v-decorator="['ywksm']" showSearch :filterOption="filterOption">
            <a-select-option v-for="i in TYPE0010" :key="i.id" :value="i.code">{{ i.name }}</a-select-option>
          </a-select>
          <!-- <a-input v-decorator="['ywksmc']"/> -->
        </a-form-item>
      </a-col>
      <a-col :md="12" :sm="24">
        <a-form-item
          label="业务课三成绩"
          :labelCol="{span: 7,offset: 1}"
          :wrapperCol="{span: 15, offset: 1}"
          selfUpdate
        >
          <a-input-number style="width: 100%" :max="9999" v-decorator="['ywkscj']"/>
        </a-form-item>
      </a-col>
      <a-col :md="12" :sm="24">
        <a-form-item
          label="加试科目"
          :labelCol="{span: 7,offset: 1}"
          :wrapperCol="{span: 15, offset: 1}"
          selfUpdate
        >
          <a-select allowClear v-decorator="['jskmm']" showSearch :filterOption="filterOption">
            <a-select-option v-for="i in TYPE0010" :key="i.id" :value="i.code">{{ i.name }}</a-select-option>
          </a-select>
          <!-- <a-input v-decorator="['jskm']"/> -->
        </a-form-item>
      </a-col>
      <a-col :md="12" :sm="24">
        <a-form-item
          label="加试成绩"
          :labelCol="{span: 7,offset: 1}"
          :wrapperCol="{span: 15, offset: 1}"
          selfUpdate
        >
          <a-input-number style="width: 100%" :max="9999" v-decorator="['jscj']"/>
        </a-form-item>
      </a-col>
      <a-col :md="12" :sm="24">
        <a-form-item
          label="加试科目2"
          :labelCol="{span: 7,offset: 1}"
          :wrapperCol="{span: 15, offset: 1}"
          selfUpdate
        >
          <a-select allowClear v-decorator="['jskmem']" showSearch :filterOption="filterOption">
            <a-select-option v-for="i in TYPE0010" :key="i.id" :value="i.code">{{ i.name }}</a-select-option>
          </a-select>
          <!-- <a-input v-decorator="['jskme']"/> -->
        </a-form-item>
      </a-col>
      <a-col :md="12" :sm="24">
        <a-form-item
          label="加试科目2成绩"
          :labelCol="{span: 7,offset: 1}"
          :wrapperCol="{span: 15, offset: 1}"
          selfUpdate
        >
          <a-input-number style="width: 100%" :max="9999" v-decorator="['jskmecj']"/>
        </a-form-item>
      </a-col>
      <a-col :md="12" :sm="24">
        <a-form-item
          label="复试成绩"
          :labelCol="{span: 7,offset: 1}"
          :wrapperCol="{span: 15, offset: 1}"
          selfUpdate
        >
          <a-input-number style="width: 100%" :max="9999" v-decorator="['fscj']"/>
        </a-form-item>
      </a-col>
      <a-col :md="12" :sm="24">
        <a-form-item
          label="初试权重"
          :labelCol="{span: 7,offset: 1}"
          :wrapperCol="{span: 15, offset: 1}"
          selfUpdate
        >
          <a-input-number style="width: 100%" :max="9999" v-decorator="['csqz']"/>
        </a-form-item>
      </a-col>
      <a-col :md="12" :sm="24">
        <a-form-item
          label="复试权重"
          :labelCol="{span: 7,offset: 1}"
          :wrapperCol="{span: 15, offset: 1}"
          selfUpdate
        >
          <a-input-number style="width: 100%" :max="9999" v-decorator="['fsqz']"/>
        </a-form-item>
      </a-col>
      <a-col :md="12" :sm="24">
        <a-form-item
          label="总成绩"
          :labelCol="{span: 7,offset: 1}"
          :wrapperCol="{span: 15, offset: 1}"
          selfUpdate
        >
          <a-input-number style="width: 100%" :max="9999" v-decorator="['zcj']"/>
        </a-form-item>
      </a-col>
      <a-col :md="12" :sm="24">
        <a-form-item
          label="缺考舞弊"
          :labelCol="{span: 7,offset: 1}"
          :wrapperCol="{span: 15, offset: 1}"
          selfUpdate
        >
          <a-select allowClear v-decorator="['qkwbm']" showSearch :filterOption="filterOption">
            <a-select-option v-for="i in TYPE0060" :key="i.id" :value="i.code">{{ i.name }}</a-select-option>
          </a-select>
        </a-form-item>
      </a-col>
      <a-col :md="12" :sm="24">
        <a-form-item
          label="年级"
          :labelCol="{span: 7,offset: 1}"
          :wrapperCol="{span: 15, offset: 1}"
          selfUpdate
        >
          <a-select allowClear v-decorator="['nj']">
            <a-select-option v-for="i in TYPE0126" :key="i.id" :value="i.code">{{ i.name }}</a-select-option>
          </a-select>
        </a-form-item>
      </a-col>
    </a-row>
    <a-row>
      <a-col :md="12" :sm="24">
        <a-form-item
          label="备注"
          :labelCol="{span: 5,offset: 1}"
          :wrapperCol="{span: 15, offset: 1}"
          selfUpdate
        >
          <a-textarea :rows="4" v-decorator="['note']"/>
        </a-form-item>
      </a-col>
    </a-row>
    <!--<a-row style="text-align:center">-->
      <!--<a-button type="primary" @click="save">保存</a-button>-->
    <!--</a-row>-->
  </a-form>
</template>
<script>
import { mapState } from 'vuex'
export default {
  props: {
    rxcj: {
      type: Object
    }
  },
  beforeCreate () {
    this.form = this.$form.createForm(this)
  },
  computed: {
    ...mapState({
      TYPE0313: state => state.app['TYPE0313'], // 入学成绩类型
      TYPE0126: state => state.app['TYPE0126'], // 年级
      TYPE0010: state => state.app['TYPE0010'],
      TYPE0114: state => state.app['TYPE0114'],
      TYPE0060: state => state.app['TYPE0060'],
    })
  },
  created () {
    this.$store.dispatch('app/setDictionary', 'TYPE0313')
    this.$store.dispatch('app/setDictionary', 'TYPE0126')
    this.$store.dispatch('app/setDictionary', 'TYPE0010')
    this.$store.dispatch('app/setDictionary', 'TYPE0114')
    this.$store.dispatch('app/setDictionary', 'TYPE0060')
  },
  mounted () {
    this.$nextTick(() => {
      this.form.setFieldsValue(this.rxcj)
    })
  },
  methods: {
    filterOption (value, op) {
      return op.componentOptions.children[0].text.indexOf(value) !== -1
    },
    // save () {
    //   this.$emit('save')
    //   this.form.validateFields((err, values) => {
    //     if (err) {
    //       return
    //     }
    //     this.$api.student.scoreAdd(values).then(res => {
    //       this.$message('操作成功')
    //     })
    //     this.form.resetFields()
    //     this.visible = false
    //   })
    // }
  }
}
</script>
